﻿Public Class FrmIniciarSesion

    Private Sub btnIngresar_Click(sender As Object, e As EventArgs) Handles btnIngresar.Click
        Dim Validador As New ValidadorDeFormularios(Me, ErrorProvider1)
        Dim Valido As Boolean = Validador.ValidarFormulario()
        If Not Valido Then
            Return
        End If

        Dim pUser As String = txtStrUsuario.Text
        Dim pClav As String = txtStrClave.Text()
        If gestorProcesos.IniciarSesion(pUser, pClav) Then
            Me.Visible = False
            FrmMain.Show()
        Else
            MsgBox("El usuario o su contraseña no son válidos.", MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, "Iniciar Sesion")
            Me.txtStrUsuario.Focus()
        End If

    End Sub

    Private Sub btnSalir_Click(sender As Object, e As EventArgs) Handles btnSalir.Click
        Me.Dispose()
    End Sub

    Private Sub FrmIniciarSesion_Activated(sender As Object, e As EventArgs) Handles Me.Activated
        Me.txtStrUsuario.Focus()
    End Sub

End Class